# -*- coding: utf-8 -*-
"""
Created on Sat Mar 27 17:06:22 2021

@author: Apple
"""


import sys
from PyQt5.QtCore import *
from PyQt5.QtGui import *
from PyQt5.QtWidgets import *

class ListWidget(QListWidget):
    def clicked(self,item):
        QMessageBox.information(self,"ListWidget","你选择了:"+item.text())

if __name__=='__main__':
    app = QApplication(sys.argv)
    listWidget = ListWidget()
    listWidget.resize(300,120)
    listWidget.addItem('Item1');
    listWidget.addItem('Item2');
    listWidget.addItem('Item3');
    listWidget.addItem('Item4');
    listWidget.setWindowTitle('QListwidget例子')
    listWidget.itemClicked.connect(listWidget.clicked)
    listWidget.show()
    sys.exit(app.exec_())
    
    
